<template>
  <div class="buttonuploadWrap">
    <el-dialog  @open="dialogOpen" @close="resetForm" :close-on-click-modal="false" title="上传历史" :append-to-body="true" :visible.sync="dialogDownload">
      <div style="padding: 4px 0 5px 0;">
        <el-table
          ref="multipleTable"
          :data="rows"
          stripe
          tooltip-effect="dark"
          style="width: 100%;"
        >
          <el-table-column
            label="备案人员"
            prop="createName"
            show-overflow-tooltip>
          </el-table-column>
          <el-table-column
            label="备案时间"
            prop="createTime"
            width="150"
          >
          </el-table-column>
          <el-table-column
            label="操作"
          >
            <template slot-scope="scope">
              <el-button
                @click="downLoadXml(scope.row.downloadPath)"
                type="text"
                size="mini"
              >下载
              </el-button>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="btnRack" style="margin-top:10px;">
        <el-button type="primary" size="mini" @click="dialogDownload = false">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
  export default {
    props:["fileType","enterpriseNo"],
    data () {
      return {
        uploadUrl: 'aaa',
        fileList: [],
        rows: [],
        dialogDownload: false,
      }
    },
    created(){

    },
    methods: {
      dialogOpen(row){
        this.axios.post(process.env.API_HOST + `/enterprise/selectFileList`, {
          "enterpriseNo":this.enterpriseNo,
          "fileAttribute":0,
          "fileType":this.fileType})
          .then(response => {
            const result = response.data
            if(result.code==200){
              this.rows = result.result
              this.dialogDownload=true
            }
          })

      },

      //下载模板
      downLoadXml(downloadPath){
//        let url2 = process.env.API_HOST + `/template/设备批量导入样表.xls`
        window.location.href = downloadPath
      },
      resetForm() {
        this.uploadForm = new FormData()
      }
    }
  }
</script>

<style lang="stylus" rel="stylesheet/stylus" >
  @import "../../../common/stylus/mixin.styl"
  .buttonuploadWrap
    display inline-block
  .uploadRack, .clickDownload, .btnRack
    text-align center
    width 100%
    line-height 40px
  .uploadRack
    /*border 1px dashed gray*/
    border-radius 10px
    width 100%
    margin 10px auto
  .el-upload-dragger
    width 100% !important



</style>
